/**
 *  GTUG Zaragoza
 *  http://zaragoza.gtugs.org/
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.gtugs.zaragoza;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

public class MainActivity extends Activity {
	
	protected static final int DIALOG_ABOUT = 1;

	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        View btnAbout = findViewById(R.id.btnAbout);
        btnAbout.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				showDialog(DIALOG_ABOUT);
			}
		});
        
        View btnMessages = findViewById(R.id.btnMessages);
        btnMessages.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				Intent intent = new Intent("org.gtugs.zaragoza.action.LIST");
				startActivity(intent);
			}
		});
    }

    
	@Override
	protected Dialog onCreateDialog(int id) {
		switch(id) {
		case DIALOG_ABOUT:
			AlertDialog.Builder builder = new AlertDialog.Builder(this);
			builder.setTitle(R.string.about_title)
				   .setMessage(R.string.about_text)
			       .setCancelable(true)
			       .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
			           public void onClick(DialogInterface dialog, int id) {
			                dialog.dismiss();
			           }
			       });
			return builder.create();
		}
		return super.onCreateDialog(id);
	}
    
    
}